/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.navid.trafalgar.mod.windtunnel;

import com.jme3.app.Application;
import com.jme3.system.AppSettings;
import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.NiftyMethodInvoker;
import de.lessvoid.nifty.builder.LayerBuilder;
import de.lessvoid.nifty.controls.button.builder.ButtonBuilder;
import de.lessvoid.nifty.elements.Element;
import de.lessvoid.nifty.screen.Screen;

/**
 *
 * @author alberto
 */
public class InterfaceGenerator {

    Nifty nifty;
    Screen screen;
    AppSettings settings;
    Application app;

    public InterfaceGenerator(final Nifty nifty, Screen parent, AppSettings settings, Application app) {
        this.nifty = nifty;
        this.screen = parent;
        this.settings = settings;
        this.app = app;
    }

    public void generate() {
        WindTunnelMain windMain = new WindTunnelMain(settings);
        PreWindTunnelController preWind = new PreWindTunnelController( app, settings, windMain);
        nifty.registerScreenController(preWind, windMain);
        nifty.addXml("Interface/interface_windtunnel.xml");
        app.getStateManager().attach(windMain);
/*
        Element parentLayer = nifty.getScreen("start").findElementByName("panel_bottom_right2");

        Element p2 = new LayerBuilder("layer").build(nifty, screen, parentLayer);
        p2.setParent(parentLayer);
        Element newButton = new ButtonBuilder("appendButton", "Append").build(nifty, screen, p2);
        newButton.setParent(p2);
        newButton.setWidth(100);
        newButton.setHeight(100);
        
        newButton.getElementInteraction().getPrimary().setOnClickMethod(new NiftyMethodInvoker(nifty, "onClick()", this));*/
    }

    public void onClick() {
        nifty.gotoScreen("preWindTunnelScreen");
    }
}
